<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>波仔的学习之旅-1</title>
</head>

<body>
    <div id="app">
        <!-- 上一页按钮 在<=0时掩藏 >0时显示-->
        <button @click="per" v-show="index>0">上一页</button>
        <div>
            <!-- 1.首先渲染第一张图片 -->
            <img :src="list[index]" alt="">
        </div>
        <!-- 下一页按钮 在>=5  length-1时掩藏 <5时显示出来-->
        <button @click="next" v-show="index<list.length-1">下一页</button>
    </div>
    <script src="vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                // 设置下标 默认为0
                index: 0,
                list: [
                    './imgs/11-00.gif',
                    './imgs/11-01.gif',
                    './imgs/11-02.gif',
                    './imgs/11-03.gif',
                    './imgs/11-04.png',
                    './imgs/11-05.png',
                ]
            },
            methods: {
                // 改变下标 渲染页面
                per() {
                    this.index--
                },
                next() {
                    this.index++
                }
            }

        })
    </script>
</body>

</html>